﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace TrainningWeekend
{
    class Class
    {
        private ArrayList students = new ArrayList();

        public void Add(Student student)
        {
            students.Add(student);
        }

        public void Remove(Student student)
        {
            students.Remove(student);
        }

        public Student this[int index]
        {
            get
            {
                Student s = (Student)students[index];
                return s;
            }
            set
            {
                students[index] = value;
            }
        }

        public Student this[string name]
        {
            get
            {
                for (int i = 0; i < students.Count; i++)
                {
                    Student s = (Student)students[i];
                    if (s.name == name)
                    {
                        return s;
                    }
                }
                return null;
            }
        }
    }
}
